Attaching package: 'scales'
The following object is masked from 'package:purrr':
discard
The following object is masked from 'package:readr':
col_factor
Attaching package: 'reshape2'
The following object is masked from 'package:tidyr':
smiths
jobs_df <-read_csv('../../data/job_data.csv')
New names:
Rows: 823 Columns: 17
── Column specification
──────────────────────────────────────────────────────── Delimiter: "," chr
(13): title, company_name, location, via, description, schedule_type, qu... dbl
(3): ...1, salary, experience lgl (1): remote
ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
Specify the column types or set `show_col_types = FALSE` to quiet this message.
• `` -> `...1`
# create a new column 'experience_group' based on 'experience'jobs_df$experience_group <-cut(jobs_df$experience, c(0, 5, 10, Inf),labels =c('0-5', '5-10', '10+'))
# Create the plotly plotap <- jobs_df_pivot %>%plot_ly(hovertext ="Degree, Salary") ap <- ap %>%add_trace(x = jobs_df_pivot$degree, y =~`0-5`, type ='bar', name ='0-5', marker =list(color ='#118C4F'))ap <- ap %>%add_trace(x = jobs_df_pivot$degree, y =~`5-10`, type ='bar', name ='5-10', marker =list(color ='#FFB90D'))ap <- ap %>%add_trace(x = jobs_df_pivot$degree, y =~`10+`, type ='bar', name ='10+' , marker =list(color ='red'))# Set the plot layout and themeap <- ap %>%layout(title =list(text ="", y =0.98, font =list(family ="Arial", size =18, color ="white")),xaxis =list(title =list(text ="Degree", font =list(family ="Arial", color ="white")), tickfont =list(color ="white")),yaxis =list(title =list(text ="Salary (USD)", font =list(family ="Arial", color ="white")),tickprefix ="$", tickformat =",",tickfont =list(color ="white")),legend =list(title =list(text ="Years of Experience", font =list(color ="white")), font =list(color ="white")),template ="plotly_dark",paper_bgcolor ="black",plot_bgcolor ="black" )# Show the plotap
saveWidget(ap, file ="../../website/plots/plot-10.html")#how do i make the background color black and all the text white (including axes, legend, etc)
# Calculate the count of remote and non-remote jobsremote_count <-c(sum(jobs_df$remote ==TRUE), sum(jobs_df$remote ==FALSE))# Create a pie chart with Plotlypc <-plot_ly(labels =c("Remote", "Non-Remote"), values = remote_count, type ="pie",textinfo ="value+percent", hole =0.6,marker =list(colors =c("#00CC96", "#EF553B"))) %>%layout(font =list(family ="Arial", color ="white"),textfont =list(color ="white"),paper_bgcolor ="black",plot_bgcolor ="black")pc